﻿@model AbpZeroTemplate.Web.Models.Account.RegisterViewModel
@using Abp.Extensions
@using Abp.Json
@using AbpZeroTemplate.MultiTenancy
@addTagHelper *, PaulMiami.AspNetCore.Mvc.Recaptcha
@section Scripts
{
    <script>
        window.passwordComplexitySetting = @Html.Raw(Model.PasswordComplexitySetting.ToJsonString(indented: true));
    </script>

    <script abp-src="/view-resources/Views/Account/Register.js" asp-append-version="true"></script>

    <recaptcha-script />
}

<div class="m-login__signin">
    <div class="m-login__head">
        <h3 class="m-login__title">
            @L("SignUp")
        </h3>
    </div>
    <form class="m-login__form m-form register-form" asp-action="Register" method="post">

        @if (@ViewBag.ErrorMessage != null)
        {
            <div class="alert alert-danger">
                <i class="fa fa-warning"></i> @ViewBag.ErrorMessage
            </div>
        }

        <input type="hidden" name="IsExternalLogin" value="@Model.IsExternalLogin.ToString()" />
        <input type="hidden" name="ExternalLoginAuthSchema" value="@Model.ExternalLoginAuthSchema" />
        <input type="hidden" name="SingleSignOn" value="@Model.SingleSignIn" />
        <input type="hidden" name="ReturnUrl" value="@Model.ReturnUrl" />

        <div class="form-group m-form__group">
            <input class="form-control placeholder-no-fix" type="text" placeholder="@L("Name")" name="Name" required value="@Model.Name" maxlength="@AbpZeroTemplate.Authorization.Users.User.MaxNameLength" />
        </div>
        <div class="form-group m-form__group">
            <input class="form-control placeholder-no-fix" type="text" placeholder="@L("Surname")" name="Surname" required value="@Model.Surname" maxlength="@AbpZeroTemplate.Authorization.Users.User.MaxSurnameLength" />
        </div>
        <div class="form-group m-form__group">
            <input class="form-control placeholder-no-fix" type="email" placeholder="@L("EmailAddress")" name="EmailAddress" required value="@Model.EmailAddress" maxlength="@AbpZeroTemplate.Authorization.Users.User.MaxEmailAddressLength" />
        </div>
        
        @if (!Model.IsExternalLogin)
        {
            <div class="form-group m-form__group">
                <input class="form-control placeholder-no-fix input-ltr" type="text" autocomplete="off" placeholder="@L("UserName")" name="UserName" value="@Model.UserName" required maxlength="@AbpZeroTemplate.Authorization.Users.User.MaxUserNameLength" />
            </div>
            <div class="form-group m-form__group">
                <input class="form-control placeholder-no-fix" type="password" autocomplete="off" id="RegisterPassword" placeholder="@L("Password")" name="Password" required />
            </div>
            <div class="form-group m-form__group">
                <input class="form-control placeholder-no-fix" type="password" autocomplete="off" placeholder="@L("PasswordRepeat")" name="PasswordRepeat" required />
            </div>
        }

        @if (ViewBag.UseCaptcha)
        {
            <p class="hint margin-top-20">
                @L("Captha_Hint")
            </p>
            <div class="form-group margin-bottom-20">
                <recaptcha />
            </div>
        }
        
        <div class="m-login__form-action">
            <a asp-action="Login"><button type="button" id="register-back-btn" class="btn btn-outline-primary  m-btn m-btn--pill m-btn--custom">@L("Back")</button></a>
            <button type="submit" id="register-submit-btn" class="btn btn-primary m-btn m-btn--pill m-btn--custom m-btn--air">@L("Submit")</button>
        </div>
    </form>
</div>
